﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;

public partial class AuditoriaReciboAdelantado : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        buscar1.Attributes.Add("OnClick", "javascript:popUpFuncionario();");
        if (!IsPostBack)
        {
            SqlDataSource1.SelectParameters.Clear();
            SqlDataSource1.SelectCommand = "SELECT * FROM [auditoria_recibo_pagos_adelantado] where cod_funcionario = @cod_funcionario";
            SqlDataSource1.SelectParameters.Add("cod_funcionario", TypeCode.Int32, "0");
            SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.Text;
            GridView1.DataBind();



        }

    }
    protected void buscar2_Click(object sender, ImageClickEventArgs e)
    {
        String cadena = (String)ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        SqlConnection conexion = new SqlConnection(cadena);
        conexion.Open();
        SqlCommand funcionario = new SqlCommand();
        try
        {

            //si cliente no esta vacio
            if (!(nombreTex.Text == ""))
            {

                SqlDataSource1.SelectParameters.Clear();
                SqlDataSource1.SelectCommand = "SELECT * FROM [auditoria_recibo_pagos_adelantado] where cod_funcionario = @cod_funcionario";
                SqlDataSource1.SelectParameters.Add("cod_funcionario", TypeCode.Int32, nombreTex.Text);
                SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.Text;
                GridView1.DataBind();




            }
            else
            {

                Page.RegisterStartupScript("alerta", "<SCRIPT> alerta('Los campos con * deben ser completados') </SCRIPT>");

            }
        }
        catch (Exception error)
        {
            Page.RegisterStartupScript("alerta", "<SCRIPT> alerta(" + error.Message.ToString() + ") </SCRIPT>");
            //hola.Text = "no guardado catch";
        }
        finally
        {
            conexion.Close();
        }
    }
    protected void buscar1_Click(object sender, ImageClickEventArgs e)
    {

    }
}
